package day8.pack1;

public abstract class Pet {
    private String nickname;
    private int health;
    private int love;


    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public int getHealth() {
        return health;
    }

    public void setHealth(int health) {
        if(health < 0 || health > 100) {
            health = 60;
            System.out.println("健康值不允许!健康值重置为:" + health);
        }
        this.health = health;
    }

    public int getLove() {
        return love;
    }

    public void setLove(int love) {
        this.love = love;
    }

    public abstract void print();
    public abstract void eat();

    /**
     * 最终的方法，不允许子类重写
     * @param a
     */
    public final void a() {}
}
